using System;
using EPiServer.Common;
using EPiServer.Common.Queries;
using EPiServer.Community.Calendar;
using EPiServer.Community.Calendar.Queries;

namespace EPiAbstractions.Community.Calendar
{
    public interface ICalendarHandlerFacade
    {
        EPiServer.Community.Calendar.Calendar AddCalendar(EPiServer.Community.Calendar.Calendar calendar);

        void UpdateCalendar(EPiServer.Community.Calendar.Calendar calendar);

        void RemoveCalendar(EPiServer.Community.Calendar.Calendar calendar);

        EPiServer.Community.Calendar.Calendar GetCalendar(Int32 id);

        CalendarCollection GetCalendars();

        CalendarCollection GetCalendars(SiteCollection sites);

        CalendarCollection GetCalendars(SiteCollection sites, NullValueAction siteNullAction);

        Int32 GetNumOfEvents(EPiServer.Community.Calendar.Calendar calendar, Boolean published);

        Event AddEvent(Event calendarEvent);

        void UpdateEvent(Event calendarEvent);

        EventRecurrence GetEventRecurrence(Int32 eventId);

        void RemoveEvent(Event calendarEvent);

        Event GetEvent(Int32 id);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, Int32 page, Int32 pageSize, EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, Int32 page, Int32 pageSize, Boolean singleOccurrencesOnly,
                                  EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, Int32 page, Int32 pageSize, out Int32 totalItems,
                                  EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, Int32 page, Int32 pageSize, Boolean singleOccurrencesOnly,
                                  out Int32 totalItems, EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, EventPublishState publishState, Int32 page, Int32 pageSize,
                                  EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, EventPublishState publishState, Int32 page, Int32 pageSize,
                                  out Int32 totalItems, EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, Int32 page, Int32 pageSize, DateTime fromDate,
                                  DateTime toDate, EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, Int32 page, Int32 pageSize, DateTime fromDate,
                                  DateTime toDate, out Int32 totalItems, EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, EventPublishState publishState, Int32 page, Int32 pageSize,
                                  DateTime fromDate, DateTime toDate, EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, EventPublishState publishState, Int32 page, Int32 pageSize,
                                  DateTime fromDate, DateTime toDate, out Int32 totalItems, EventSortOrder[] sortOrder);

        EventCollection GetEvents(EPiServer.Community.Calendar.Calendar calendar, EventPublishState publishState, Int32 page, Int32 pageSize,
                                  DateTime fromDate, DateTime toDate, Boolean singleOccurrencesOnly, out Int32 totalItems,
                                  EventSortOrder[] sortOrder);

        Invite AddInvite(Invite invite);

        Invite GetInvite(Int32 id);

        Invite GetInvite(Event calendarEvent, IAuthor invitee);

        InviteCollection GetInvites(Event calendarEvent, Int32 page, Int32 pageSize, InviteSortOrder[] sortOrder);

        InviteCollection GetInvites(Event calendarEvent, Int32 page, Int32 pageSize, out Int32 totalItems, InviteSortOrder[] sortOrder);

        InviteCollection GetInvites(Event calendarEvent, RegistrationStatus registrationStatus, Int32 page, Int32 pageSize,
                                    InviteSortOrder[] sortOrder);

        InviteCollection GetInvites(Event calendarEvent, RegistrationStatus registrationStatus, Int32 page, Int32 pageSize,
                                    out Int32 totalItems, InviteSortOrder[] sortOrder);

        void UpdateInvite(Invite invite);

        Registration AddRegistration(Registration registration);

        Registration GetRegistration(Int32 id);

        Registration GetRegistration(Event calendarEvent, IAuthor registrant);

        RegistrationCollection GetRegistrations(Event calendarEvent, Int32 page, Int32 pageSize, RegistrationSortOrder[] sortOrder);

        RegistrationCollection GetRegistrations(Event calendarEvent, Int32 page, Int32 pageSize, out Int32 totalItems,
                                                RegistrationSortOrder[] sortOrder);

        void RemoveRegistration(Registration registration);

        event EPiServerCommonEventHandler EventAdded;

        event EPiServerCommonEventHandler EventUpdated;

        event EPiServerCommonEventHandler EventRemoved;

        event EPiServerCommonEventHandler CalendarAdded;

        event EPiServerCommonEventHandler CalendarUpdated;

        event EPiServerCommonEventHandler CalendarRemoved;

        event EPiServerCommonEventHandler InviteAdded;

        event EPiServerCommonEventHandler InviteUpdated;

        event EPiServerCommonEventHandler RegistrationAdded;

        event EPiServerCommonEventHandler RegistrationRemoved;

        CalendarCollection GetQueryResult(CalendarQuery query);

        CalendarCollection GetQueryResult(CalendarQuery query, Int32 page, Int32 pageSize);

        CalendarCollection GetQueryResult(CalendarQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);

        EventCollection GetQueryResult(EventQuery query);

        EventCollection GetQueryResult(EventQuery query, Int32 page, Int32 pageSize);

        EventCollection GetQueryResult(EventQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);

        InviteCollection GetQueryResult(InviteQuery query);

        InviteCollection GetQueryResult(InviteQuery query, Int32 page, Int32 pageSize);

        InviteCollection GetQueryResult(InviteQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);

        RegistrationCollection GetQueryResult(RegistrationQuery query);

        RegistrationCollection GetQueryResult(RegistrationQuery query, Int32 page, Int32 pageSize);

        RegistrationCollection GetQueryResult(RegistrationQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);
    }
}